package com.tbit.uqbike.service.business.impl;

import com.tbit.uqbike.manager.exception.BaseException;
import com.tbit.uqbike.object.pojo.ParkPointVert;
import com.tbit.uqbike.service.business.ParkPointVertService;
import com.tbit.uqbike.webmanager.dao.core.ParkPointVertDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @Author: chen
 * @Description: 垂直定位配置
 * @Date: 创建于 11:33 2020/8/14
 */
@Service
public class ParkPointVertServiceImpl implements ParkPointVertService {
    @Autowired
    private ParkPointVertDao parkPointVertDao;

    @Override
    public ParkPointVert getByParkPointId(Integer parkPointId) {
        return parkPointVertDao.getByParkPointId(parkPointId);
    }

    @Override
    public void insert(ParkPointVert parkPointVert) {
        ParkPointVert parkPointVertDB = getByParkPointId(parkPointVert.getParkPointId());
        if (parkPointVertDB != null) {
            throw new BaseException("ver.holder.is.exist");
        }
        parkPointVertDao.insert(parkPointVert);
    }

    @Override
    public void edit(ParkPointVert parkPointVert) {
        parkPointVertDao.edit(parkPointVert);
    }
}
